package com.zl.smartmall.library.po;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

/**
 * 报价
 * @author Administrator
 *
 */
public class ForecastPrice implements Serializable{
	private String price;//报价
	private String name;
	private int id;
	private String unit;
	public String getUnit() {
		return unit;
	}
	public void setUnit(String unit) {
		this.unit = unit;
	}
	public String getPrice() {
		return price;
	}
	public void setPrice(String price) {
		this.price = price;
	}
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public int getId() {
		return id;
	}
	public void setId(int id) {
		this.id = id;
	}
	
	public static List<ForecastPrice> parse(JSONArray jsonArray) throws JSONException{
		List<ForecastPrice> forecastPrices = new ArrayList<ForecastPrice>();
		for(int i = 0;i<jsonArray.length();i++){
			JSONObject jsonObject = jsonArray.getJSONObject(i);
			ForecastPrice  price = new ForecastPrice();
			price.price = jsonObject.getString("price");
			price.id = jsonObject.getInt("id");
			price.name = jsonObject.getString("name");
			price.unit = jsonObject.getString("unit");
			forecastPrices.add(price);
		}
		return forecastPrices;
		
	}
}
